<?php

class Login extends Controller {

	function Login()
	{
		parent::Controller();	
	}
	
	function index()
	{

		$host=strtolower($_SERVER['HTTP_HOST']);
		 
		echo " <br><form action=\"http://".$host."/ci_rest/index.php/login\" method=\"post\">";

		$this->load->view('login_view');

		if($_SERVER['REQUEST_METHOD']=="POST"){
		$Sql="select count(*) as cnt from site_info where 
				site_url='".$host."' 
				and site_user='".$_POST['site_user']."' 
				and site_password=md5('".$_POST['site_password']."')";
		$query = $this->db->query($Sql);
		$row=$query->result();


		if($row[0]->cnt==1)
			echo "Right Password";
			
		else
			echo "Please Check your username and password.";

			

		

		}
	}
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */